extends Node2D

const SPEED := 60 
var direction :float = 1 :
	set(v):
		direction = v
		graphics.scale.x = v

@onready var graphics: Node2D = $graphics
@onready var front_ray: RayCast2D = $graphics/FrontRay
@onready var foot_ray: RayCast2D = $graphics/FootRay



func _process(delta: float) -> void:
	if not foot_ray.is_colliding():
		print("no foot")
	if front_ray.is_colliding() or not foot_ray.is_colliding():
		direction *= -1
	position.x += direction * delta * SPEED
